package com.jie.controller;

import com.jie.service.OssService;
import com.jie.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
//跨域
@CrossOrigin
@RequestMapping("/oss/file")
public class OssContrller {
    @Autowired
    private OssService ossService;

    @PostMapping
    public R uploadOss(MultipartFile file){
    //MultipartFile 获得上传文化
       String url= ossService.uploadFile(file);
        return R.ok().data("url",url);
    }
}
